package com.jy.wms.controller;

import com.jy.wms.common.UUIDUtils;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.pojo.WmsInventoryTask;
import com.jy.wms.service.WmsInventoryTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: WmsInventoryTaskController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author Jane
 * @Date Tue Jan 09 09:28:57 CST 2018
 */
@Controller
@RequestMapping("/wmsinventorytask")
@Api(value = "/wmsinventorytask", description = "盘点任务")
public class  WmsInventoryTaskController extends BaseController<WmsInventoryTaskService,WmsInventoryTask> {

//    @PostMapping(value = "list")
//    @ApiOperation(value = "查询信息",response = JSONObject.class, notes = "查询信息")
//    public @ResponseBody ResultPage<WmsInventoryTask> getWmsInventoryTask(@RequestBody WmsInventoryTask entity,HttpSession session) {
//        Page<WmsInventoryTask> list= baseService.baseSelectPage(entity);
//            return renderPage(list);
//    }

    @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息",response = JSONObject.class, notes = "删除信息")
    public @ResponseBody
    JsonResult deleteWmsInventoryTask(@RequestBody List<String> ids) {
        Integer flag=baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息",response = JSONObject.class, notes = "新增信息")
    public @ResponseBody
    JsonResult addWmsInventoryTask(@RequestBody WmsInventoryTask entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsInventoryTask/{id}")
    @ApiOperation(value = "查看单个信息",response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody
    WmsInventoryTask getWmsInventoryTaskById(@PathVariable("id") String id) {
        WmsInventoryTask entity=baseService.baseSelectByPrimaryKey(id);
        return entity;
    }
//    @PostMapping(value = "edit")
//    @ApiOperation(value = "编辑信息",response = JSONObject.class, notes = "编辑信息")
//    public @ResponseBody JsonResult editWmsInventoryTask(@RequestBody WmsInventoryTask entity) {
//        Integer flag=baseService.baseUpdateByPrimaryKeySelective(entity);
//        return renderSuccess("修改成功");
//    }
}
